﻿using System;
using System.Linq;
using System.ComponentModel.DataAnnotations;
using CodeCamp.Models.Shared;
using CCM = CodeCamp.Model;
using System.Web.Mvc;

namespace CodeCamp.Models.Sessions
{
  public class SessionsEditViewModel : SharedViewModel
  {
    public SessionsEditViewModel()
    {
      HideNotes = true;
    }

    public int SessionId { get; set; }
    [Required]
    [MaxLength(128)]
    public string Title { get; set; }
    [Required]
    [MaxLength(4000)]
    public string Description { get; set; }
    public int PresenterId { get; set; }
    [MaxLength(128)]
    public string SessionMaterialsUrl { get; set; }

    [Required]
    public CCM.Session.SessionStatus Status { get; set; }

    [Required]
    public int StatusID
    {
        get { return (int)Status; }
        set { Status = CCM.Session.GetSessionStatus(value); }
    }

    public SelectList StatusSelectList
    {
      get
      {
          var statusItems = from CCM.Session.SessionStatus s in Enum.GetValues(typeof(CCM.Session.SessionStatus))
                            select new { ID = (int)s, Name = s.ToString() };
          return new SelectList(statusItems, "ID", "Name", CCM.Session.SessionStatus.Undefined.ToString());
      }
    }

    [MaxLength(10)]
    public string DesiredRoomSize { get; set; }

    public bool HideNotes { get; set; }

    [MaxLength(1024)]
    public string PrivateNotes { get; set; }

    [MaxLength(1024)]
    public string OrganizerNotes { get; set; }
  }
}